 <%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="${ctx}/styles/public.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/common.js"></script>
<%@ include file="/commons/validation.jsp"%>
<script type="text/javascript">
	function submitForm(){
		var flag = $("auditingForm").fireEvent("onsubmit");
		if(!flag) return;
		setButtonStatus(false);
		$("mySubmit").click();
	}
	function setButtonStatus(statuz){ //设置按钮状态  true 可用,false不可用
		$("btn1_22").disabled = !statuz;
		$("btn1_32").disabled = !statuz;
	}
/***************选择人*****************/
	var principalInfo = new Array();
	var empNames = new Array();

	function openSelectPerson(){ //打开选人的界面
	  	var url = "${ctx}/common_employeeQuery.do?method=initSelectPsrsonMain";
	  	url += "&frameName=appEditFrame";
	  	url += "&callBack=setPersonInfo";
	  	url += ("&hadSelectUserId=" + principalInfo.toString());
	  	url += "&multiple=true";
		top.windowOpen(url, "selectPerson", "选人", 530, 700,true,"selectPerson");
	}
	function setPersonInfo(info){ //设置选人信息
		var personInfos = info.split(";");
		principalInfo = new Array();
		empNames = new Array();
		var temp = null;
		for(var i = 0; i < personInfos.length; i++){
			temp = personInfos[i].split(",");
			addEmployee(temp[0],temp[1]);
		}
		showSelected();
	}
	function addEmployee(empId,empName){

		for(var i = 0; i < principalInfo.length; i++){
			//如果该员工ID已经存在于数组中 则表示员工已经选择 直接返回
			if(principalInfo[i] == empId) return;
		}
		//经过上面的判断,说明该员工不存在,则新添加一个
		principalInfo[principalInfo.length]  = empId;
		empNames[empNames.length] = empName;
	}
	/*********选人选部门的公用方法--显示所选择的部门何人*************/
	function showSelected(){
		$("employeIds").value = principalInfo.toString();
		$("employeName").value = empNames.toString();
	}
/*****************************/
    function init(){
	 	<c:forEach items="${approvalItemVO.approvallers}" var="employee">
		      principalInfo[principalInfo.length] = "${employee.emplyeeId}";
			  empNames[empNames.length] = "${employee.employeeName}";
		</c:forEach>
		showSelected();
    }
</script>
</head>

<body onload="init();">
<iframe id="showResult" name="showResult" style="display:none" onload="setButtonStatus(true);"></iframe>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg">
	    <table border="0" cellpadding="0" cellspacing="0">
	      <tr>
	        <td>
	        	<img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" />
	        	<span class="window_head_intext">修改装修审核项目</span>
	        </td>
	      </tr>
	    </table>
    </td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td class="content">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
      	<form id="auditingForm" method="post" class="required-validate" target="showResult"
      		   action="${ctx}/system_auditingItemAction.do?method=edit">
      		   <input type="submit" id="mySubmit" style="display:none">
      		   <input type="hidden" id="option" name="option" value="">
      		   <input type="hidden" id="keyword" name="keyword" value="${approvalItemVO.keyword}">
        <td class="aux_outtable_color">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
          <tr>
            <td class="aux_intable_td1">装修申请审核项目名称：</td>
            <td class="aux_intable_require">
            	<input name="itemName" type="text"
            			class="inputtext required validate-char validate-ajax"
            			validateUrl="${ctx}/system_auditingItemAction.do?method=validateItemName"
            			relativeId="keyword"
            			value="${approvalItemVO.itemName}" size="32" maxlength="50"/>
            </td>
          </tr>
          <tr>
            <td class="aux_intable_td1">用 户：</td>
            <td class="aux_intable_require">
	            <table border="0" cellspacing="0" cellpadding="0">
	              <tr>
	                <td>
	                	<input id="employeName" name="employeName" type="text" readonly="readonly"
	                			class="inputtext required" afterInsert="employeNameShow"
	                			value=""  size="32" maxlength="100"/>
	                	<input id="employeIds" name="employeIds" type="hidden" value="">
	                </td>
	                <td width="4">&nbsp;</td>
	                <td>
	                	<a href="#"  onClick="openSelectPerson();" onFocus="this.blur()">
	                		<img src="${ctx}/images/ico_cz.gif" width="16" height="16" border="0" />
	                	</a>
	                	<span id="employeNameShow"></span>
	                </td>
	              </tr>
	            </table>
            </td>
          </tr>
        </table>
        </td>
        </form>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">

	  <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
          <tr>
        <td class="btn_between_space"></td>
            <td class="buttonOffLeft" id="btn1_21"></td>
     		<td class="buttonOffMiddle" id="btn1_22"
     			onClick="$('option').value='save';submitForm();"
     			onMouseOver="btn_change_over(2)"
     			onMouseOut="btn_change_out(2)"
     			onBlur="btn_change(2)">
     			<img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保 存
     		</td>
                <td class="buttonOffRight" id="btn1_23"></td>
              </tr>
          </table></td>
          <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
                <td class="buttonOffMiddle" id="btn1_32"
                	onClick="windowClose();"
                	onMouseOver="btn_change_over(3)"
                	onMouseOut="btn_change_out(3)"
                	onBlur="btn_change(3)">

                	<img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" />
                	关 闭
                </td>
                <td class="buttonOffRight" id="btn1_33"></td>
              </tr>
          </table></td>
        </tr>
    </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
</body>
</html>